﻿using SqlSugar;
using System.Collections.Generic;
using System.Security.Policy;

namespace QingZhouLinYe_Web.Models
{

    [SugarTable("QuHua")]
    public class QuHua
    {

        [SugarColumn(IsIdentity = true, IsPrimaryKey = true,ColumnDescription ="主键Id", IsTreeKey = true)]
        public int Id { get; set; }

        [SugarColumn(ColumnDescription ="上级Id",IsTreeKey =true)]
        public int UpId { get; set; }

        [SugarColumn(ColumnDataType = "varchar(50)",ColumnDescription ="区划名称")]
        public string MingCheng { get; set; }

        [SugarColumn(ColumnDescription = "中心位置", IsNullable = true, ColumnDataType = "geometry", SqlParameterDbType = typeof(LocationConverter))]
        public Location CenterShape { get; set; }

        [SugarColumn(ColumnDescription = "边界", IsNullable = true, ColumnDataType = "geometry", SqlParameterDbType = typeof(PolygonConverter))]
        public Polygon BorderShape { get; set; }

        [Navigate(NavigateType.OneToMany,nameof(FangHuoDanWei.QuHuaId))]   //配置一对多关系，定义一个区划有多个防火单位
        public List<FangHuoDanWei> FangHuoDanWeis { get; set; }

        [Navigate(NavigateType.OneToMany, nameof(UpId))]  //导航一对多
        public List<QuHua> Child { get; set; }

    }
}